Measurement based uncomputation for quantum circuit optimization

ABSTRACT

Methods and apparatus for optimizing a quantum circuit. In one aspect, a method includes identifying one or more sequences of operations in the quantum circuit that un-compute respective qubits on which the quantum circuit operates; generating an adjusted quantum circuit, comprising, for each identified sequence of operations in the quantum circuit, replacing the sequence of operations with an X basis measurement and a classically-controlled phase correction operation, wherein a result of the X basis measurement acts as a control for the classically-controlled correction phase operation; and executing the adjusted quantum circuit.

CLAIM OF PRIORITY

This application is a continuation application of, and claims priority to, U.S. patent application Ser. No. 17/332,723, filed on May 27, 2021, which is a continuation application of U.S. patent application Ser. No. 16/833,344, filed on Mar. 27, 2020 (now U.S. Pat. No. 11,030,546), which claims the benefit, under 35 U.S.C. § 119(e), of U.S. Patent Application Serial No. 62/826,142, filed on Mar. 29, 2019. The disclosure of each of the foregoing applications is incorporated herein by reference in their entirety.

BACKGROUND

This specification relates to quantum computing.

Classical computers have memories made up of bits, where each bit can represent either a zero or a one. Quantum computers maintain sequences of quantum bits, called qubits, where each quantum bit can represent a zero, one or any quantum superposition of zeros and ones. Quantum computers operate by setting qubits in an initial state and controlling the qubits, e.g., according to a sequence of quantum logic gates.

SUMMARY

This specification describes techniques for optimizing quantum circuits using measurement-based uncomputation.

In general, one innovative aspect of the subject matter described in this specification can be implemented in a method for uncomputing one or more qubits, the method comprising: identifying one or more sequences of operations for performing an un-compute operation on the one or more qubits, respectively; for each identified sequence of operations, replacing the sequence of operations with an X basis measurement and a classically-controlled phase correction operation to provide an adjusted one or more sequence of operations for performing the un-compute operation, wherein a result of the X basis measurement acts as a control for the classically-controlled correction phase operation; and executing the adjusted one or more sequence of operations on the one or more qubits, respectively.

Other implementations of these aspects includes corresponding computer systems, apparatus, and computer programs recorded on one or more computer storage devices, each configured to perform the actions of the methods. A system of one or more classical and/or quantum computers can be configured to perform particular operations or actions by virtue of having software, firmware, hardware, or a combination thereof installed on the system that in operation causes or cause the system to perform the actions. One or more computer programs can be configured to perform particular operations or actions by virtue of including instructions that, when executed by data processing apparatus, cause the apparatus to perform the actions.

The foregoing and other implementations can each optionally include one or more of the following features, alone or in combination. In some implementations a first sequence of operations for un-computing a respective qubit comprises a first subset of operations that put the qubit in a known state, for example a zero state.

In some implementations the identified one or more sequences of operations comprise X-axis interactions.

In some implementations the identified one or more sequences of operations comprise at least one CNOT operation that targets a first qubit and uses a second qubit as a control.

In some implementations replacing the sequence of operations comprises replacing the CNOT operation with: a measurement of the first qubit in the X basis, and application of a Z gate on the first qubit, wherein application of the Z gate is conditioned on a result of the measurement of the first qubit in the X basis.

In some implementations executing the adjusted one or more sequences of operations on the one or more qubits comprises executing the adjusted one or more sequences of operations on the one or more qubits in a surface-code architecture.

In some implementations the one or more sequences of operations for performing an un-compute operation on the one or more qubits are part of a quantum circuit, the quantum circuit comprising multiple operations for uncomputing a table lookup operation, wherein the multiple operations operates on i) a control register comprising one or more qubits, ii) an address register comprising one or more qubits, and iii) a target register comprising one or more qubits.

In some implementations replacing the sequence of operations with an X basis measurement and a classically-controlled phase correction operation to provide an adjusted one or more sequence of operations for performing the un-compute operation comprises generating an adjusted quantum circuit.

In some implementations executing the adjusted one or more sequences of operations on the one or more qubits, respectively, comprises executing the adjusted quantum circuit, comprising: applying a CNOT operation to a first qubit in the address register and a second qubit, wherein: the first qubit represents a least significant bit, the second qubit comprises an ancilla qubit prepared in a 1 state, and the first qubit acts as a control for the CNOT operation; applying a first Hadamard gate to the first qubit and a second Hadamard gate to the second qubit; applying multiple X basis measurements on qubits in the target register to determine a set of address register states that require an amplitude negation to uncompute the table lookup operation; applying a classically controlled phase correction operation based on the determined set of address register states, comprising applying an additional table lookup computation from a fixup table onto the first qubit and second qubit to negate amplitudes of the states in the determined set of address register states; and uncomputing the first qubit and second qubit.

In some implementations entries of the fixup table specify respective two output bits defined by the determined set of states.

In some implementations entries F_(j) of the fixup table F are expressed as

$F_{j} = \left\{ \begin{matrix} {{00\ \left( {{2j} \notin S} \right)} \land \left( {{{2j} + 1} \notin S} \right)} \\ {{01\ \left( {{2j} \in S} \right)} \land \left( {{{2j} + 1} \notin S} \right)} \\ {{10\ \left( {{2j} \notin S} \right)} \land \left( {{{2j} + 1} \in S} \right)} \\ {{11\ \left( {{2j} \in S} \right)} \land \left( {{{2j} + 1} \in S} \right)} \end{matrix} \right.$

where S represents the determined set of states.

In some implementations uncomputing the first qubit and the second qubit comprises: applying a third Hadamard gate to the first qubit and a fourth Hadamard gate to the second qubit, and applying a CNOT operation to the first qubit and second qubit, where the first qubit acts as a control for the CNOT operation.

In some implementations the adjusted quantum circuit is configured to operate on multiple clean ancilla qubits.

In some implementations the adjusted quantum circuit is configured to operate on multiple dirty ancilla qubits.

The subject matter described in this specification can be implemented in particular ways so as to realize one or more of the following advantages.

The presently described techniques produce optimized quantum circuits that, when executed, can perform corresponding quantum computations with increased computational efficiency.

For example, the presently described techniques can produce optimized quantum circuits for uncomputing table lookup operations. Instead of reversing the quantum circuit for computing the table lookup operation, X measurements and classically controlled phase fix up operations are applied. Table lookup operations can therefore be uncomputed with reduced computational complexity. The computational complexity does not depend on the size of the target register M. In addition, ancilla qubits used by the table lookup computation only need to be used temporarily, and can be erased after the table lookup computation and reused.

In addition, because the lookup result is measured in the X basis, qubits that were part of the lookup result are available for use in other operations (whereas otherwise they would have been unavailable for use.) This somewhat counterintuitively means that starting the uncomputation process can result in more space being available right away (instead of only after it ends). For example, the uncomputation can free up so many qubits that the uncomputation does not require ancilla qubits from other sources. This means that the uncomputation can run inline.

The details of one or more implementations of the subject matter of this specification are set forth in the accompanying drawings and the description below. Other features, aspects, and advantages of the subject matter will become apparent from the description, the drawings, and the claims.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows an example quantum computation system.

FIG. 2 is a flow diagram of an example process for uncomputing one or more qubits.

FIG. 3 is a flow diagram of an example process for uncomputing a table lookup using an optimized quantum circuit.

FIG. 4 is a circuit diagram of two example quantum circuits for un-computing a table lookup.

FIG. 5 is a circuit diagram of an example quantum circuit for applying a phase correction operation with clean ancilla qubits.

FIG. 6 is a circuit diagram of an example quantum circuit for applying a phase correction operation with dirty ancilla qubits.

Like reference numbers and designations in the various drawings indicate like elements.

DETAILED DESCRIPTION Overview

This specification describes techniques for optimizing quantum circuits by uncomputing qubits using measurement-based uncomputation. Sequences of unitary operations that uncompute a qubit, e.g., those involving X-axis interactions, are replaced with measurements, e.g., X-basis measurements, and classically controlled phase correction operations. The techniques can be applied to various quantum circuit constructions, including quantum circuits for computing and uncomputing table lookups.

Example Hardware

FIG. 1 depicts an example quantum computation system 100. The system 100 is an example of a system implemented as quantum and classical computer programs on one or more quantum computing devices and classical computers in one or more locations, in which the systems, components, and techniques described below can be implemented.

The system 100 includes a quantum computing device 102 in data communication with one or more classical processors 104. For convenience, the quantum computing device 102 and classical processors 104 are illustrated as separate entities, however in some implementations the classical processors 104 may be included in the quantum computing device 102.

The quantum computing device 102 includes components for performing quantum computation. For example, the quantum computing device 102 includes quantum circuitry 106 and control devices 108.

The quantum circuitry 106 includes components for performing quantum computations, e.g., components for implementing the various quantum circuits and operations described in this specification. For example, the quantum circuitry may include a quantum system that includes one or more multi-level quantum subsystems, e.g., qubits 114. The qubits 114 are physical qubits that may be used to perform algorithmic operations or quantum computations. The specific realization of the one or more qubits and their interactions may depend on a variety of factors including the type of quantum computations that the quantum computing device 102 is performing. For example, the qubits may include qubits that are realized via atomic, molecular or solid-state quantum systems. In other examples the qubits may include, but are not limited to, superconducting qubits, e.g., Gmon or Xmon qubits, or semi-conducting qubits. Further examples of realizations of multi-level quantum subsystems include fluxmon qubits, silicon quantum dots or phosphorus impurity qubits. In some cases the quantum circuitry may further include one or more resonators attached to one or more superconducting qubits. In some cases ion traps, photonic devices or superconducting cavities (with which states may be prepared without requiring qubits) may be used.

In this specification, the term “quantum circuit” is used to refer to a sequence of quantum logic operations that can be applied to a qubit register to perform a respective computation. Quantum circuits comprising different quantum logic operations, e.g., single qubit gates, multi-qubit gates, etc., may be constructed using the quantum circuitry 106. Constructed quantum circuits can be operated/implemented/executed using the control devices 108.

The type of control devices (or control circuits) 108 included in the quantum system depend on the type of qubits included in the quantum computing device. For example, in some cases the multiple qubits can be frequency tunable. That is, each qubit may have associated operating frequencies that can be adjusted using one or more control devices. Example operating frequencies include qubit idling frequencies, qubit interaction frequencies, and qubit readout frequencies. Different frequencies correspond to different operations that the qubit can perform. For example, setting the operating frequency to a corresponding idling frequency may put the qubit into a state where it does not strongly interact with other qubits, and where it may be used to perform single-qubit gates. In these examples the control devices 108 may include devices that control the frequencies of qubits included in the quantum circuitry 106, an excitation pulse generator and control lines that couple the qubits to the excitation pulse generator. The control devices may then cause the frequency of each qubit to be adjusted towards or away from a quantum gate frequency of an excitation pulse on a corresponding control driveline.

The control devices 108 may further include measurement devices, e.g., readout resonators. Measurement results obtained via measurement devices may be provided to the classical processors 104 for processing and analyzing. Measurement devices perform physical measurements on properties of the qubits, either directly or indirectly, from which the state(s) of the qubits can be inferred.

Programming the Hardware: An Example Process for Optimizing a Quantum Circuit

FIG. 2 is a flow diagram of an example process 200 for uncomputing one or more qubits. For convenience, the process 200 will be described as being performed by a system of one or more classical and quantum computing devices located in one or more locations. For example, a quantum computation system, e.g., the system 100 of FIG. 1, appropriately programmed in accordance with this specification, can perform the process 200.

The system identifies one or more sequences of operations for performing an uncompute operation on the one or more qubits, respectively (step 202). For example, the system may identify one or more sequences of operations that uncompute one or more qubits in a quantum circuit. A sequence of operations that un-computes a respective qubit can include a sequence of unitary operations that put the qubit in a known state, for example a zero state. In some implementations the identified one or more sequences of operations can include X-axis interactions that put one or more qubits in a zero state.

For each identified sequence of operations, the system replaces the sequence of operations with an X basis measurement and a classically-controlled phase correction operation to provide an adjusted one or more sequence of operations for performing the uncompute operation (step 204). A result of the X basis measurement acts as a control for the classically-controlled phase correction operation.

The sequences of operations that uncompute respective qubits are replaced with operations that include a computationally more efficient operation (implemented by measurements) that is probabilistic but will be close to a target result, and a classical operation that uses measurement results to determine how the computationally more efficient operation differed the intended operation and applies additional operations to remove the difference. The benefit is that the expected cost of these dynamically chosen operations is lower than the cost of an alternative implementation.

For example, in some implementations a quantum circuit may uncompute a qubit q by performing a series of unitary operations, where the last operation involving q is a CNOT operation that targets q. In these implementations the system may first measure q in the X basis and replace the CNOT operation with a Z gate conditioned on a result of the measurement of q in the X basis. A CNOT gate is equivalent to an X gate on the target control controlled by a Z type control on the control qubit, or equivalently to an X type control on the target controlling a Z gate on the control qubit. The deferred measurement principle states that a classical control after a measurement is equivalent to a quantum control before a measurement. This principle can be applied to the CNOT target in the X basis instead of to the CNOT control in the Z basis. The application of the Z gate is controlled by the measurement via a classical control system. The classical control system can be configured to check the result of the particular measurement and, if the result is True, cause a Z gate to be applied. The Z gate may be applied either by instructing the quantum computer to perform the Z gate, or by updating a classically tracked so-called Pauli frame (which tracks, for each qubit, whether it has been bit flipped and/or phase flipped, which ultimately results in certain measurement results being inverted before being processed).

Providing the adjusted one or more sequences of operations for performing an uncompute operation can include generating an adjusted quantum circuit. Generating an adjusted quantum circuit may include adjusting a setup or operational parameters of the quantum computation system that executes the adjusted quantum circuit. For example, control devices or circuits used to implement the different sequences of operations that include X basis measurements and classically controlled phase operations can be appropriately initialized/configured.

The system executes the adjusted one or more sequences of operations on the one or more qubits, respectively (step 206). For example, the system can execute the adjusted quantum circuit described above using a quantum computing device, e.g., using the above described appropriately initialized/configured control devices. In some implementations the system executes the adjusted quantum circuit in a surface-code architecture. In implementations where CNOT operations are replaced with an X basis measurement and classically controlled Z gate, as described above, executing the adjusted quantum circuit in a surface code architecture can be particularly advantageous because Z gates require no spacetime volume in the surface code.

Programming the Hardware: Example Processes for Optimizing a Quantum Circuit that Uncomputes a Table Lookup

In some implementations the identified sequences of operations/quantum circuit described above with reference to FIG. 2 can be a quantum circuit that computes and uncomputes a table lookup. In these implementations, the quantum circuit operates on an address register of qubits and a target register of qubits. The state of the address register encodes address information that determines a respective state of the target register. The state of the target register encodes a target output. A relationship between each state of the address register and each state of the target register can be represented as a table.

Each entry in the table can be represented by a respective multi-control multi-target CNOT operation, where qubits in the address register act as controls and qubits in the target register are targets for the CNOT operation. There can be one control (or anti control) for each address qubit, and one CNOT target (or skip) for each output qubit. For example, suppose the state of the address register points to entry number 2 of the table and the entry is the bit string 10011000. This means that a table lookup compute operation toggles the qubits at offset 0, 3, and 4 of the target register conditioned on the address register storing 2.

A corresponding table lookup uncompute operation negates the amplitude of the |2

state of the address register, conditioned on the X₀·X₃·X₄ observable of the qubits in the target register. Because the qubits in the target register are measured in the X basis, the value of the X₀·X₃·X₄ observable is known. Therefore, it is known whether or not the amplitude of the |2

state of the address register needs to be negated or not. Extending the example, by using the measured observables, it can be determined for each state |j

of the address register whether the or not the state |j

needs to be negated or not. Once the required negations are determined, performing the negations uncomputes the table lookup.

Formally, a table lookup computation be defined as applying the transformation

$\left. {{\left. \left. {{\left. {\sum\limits_{j = 1}^{d}{❘j}} \right\rangle ❘}0} \right\rangle\mapsto{\sum\limits_{j = 1}^{d}{❘j}} \right\rangle ❘}{f(j)}} \right\rangle$

where |j

represents the state of the address register, |0

represents the initial state of the target register, and |f(j)

represents a transformed state of the target register after a table lookup f:

_(d)

₂ ^(M) is computed, with k representing a power of 2 satisfying 1<k<d, and M representing the size of the target register.

Uncomputing a table lookup can be defined as applying the transformation

$\left. {{\left. \left. {{\left. {\sum\limits_{j = 1}^{d}{❘j}} \right\rangle ❘}{f(j)}} \right\rangle\mapsto{\sum\limits_{j = 1}^{d}{❘j}} \right\rangle ❘}0} \right\rangle.$

As described in more detail below, uncomputing a table lookup using the techniques described in this specification can be achieved using ┌d/k┐+k Toffoli gates (CCNOT gates) and k+┌log(d/k)┐ clean ancilla qubits (qubits that are prepared in a known state), or alternatively using 2┌d/k┐+4M(k−1) Toffoli gates, k−1 dirty ancilla qubits (qubits that are already being used for another purpose by the quantum computing hardware and are not necessarily initialized to a known state) and ┌log(d/k)┐+1 clean ancilla qubits.

FIG. 3 is a flow diagram of an example process 300 for uncomputing a table lookup using an optimized quantum circuit. For convenience, the process 300 will be described as being performed by a system of one or more classical or quantum computing devices located in one or more locations. For example, a quantum computation system, e.g., the system 100 of FIG. 1, appropriately programmed in accordance with this specification, can perform the process 300.

The system determines a set S of address register states that require an amplitude negation in order to complete the uncomputation of the table lookup (step 302). The determined set S will be a subset of the set of all address register states from |

to |d−1

, and depends on the particular table lookup computation that is being uncomputed. The system can determine the set S using X basis measurements of the qubits in the target register, as described above with reference to FIG. 2.

The system applies a CNOT operation to qubit q in the address register that represents the least significant bit and a clean ancilla qubit u prepared in the |1

state (step 304). The qubit q acts as the control for the CNOT operation. The system then applies a Hadamard gate to both qubit q and qubit u (step 306).

The system performs a classically controlled phase correction operation based on the determined set S (step 308). The classically controlled phase correction operation includes an additional table lookup computation from a fixup table F onto the qubits q and u. Entries F_(j) of the fixup table F specify respective two output bits defined by the set S:

$F_{j} = \left\{ \begin{matrix} {{00\ \left( {{2j} \notin S} \right)} \land \left( {{{2j} + 1} \notin S} \right)} \\ {{01\ \left( {{2j} \in S} \right)} \land \left( {{{2j} + 1} \notin S} \right)} \\ {{10\ \left( {{2j} \notin S} \right)} \land \left( {{{2j} + 1} \in S} \right)} \\ {{11\ \left( {{2j} \in S} \right)} \land \left( {{{2j} + 1} \in S} \right)} \end{matrix} \right.$

The fixup table F relates to all of the qubits in the address register, except for the least significant qubit. The particular construction of the fixup table F and particular preparation of q and u in steps 304, 306 ensures that the amplitudes of all states in S are negated. Negation of the amplitudes in the determined set S uncomputes the table lookup, and the system completes the uncomputation by uncomputing the preparation of q and u (step 310). Uncomputing the preparation of q and u can include applying a Hadamard gate to both q and u, and applying a CNOT operation to q and u, where q acts as the control.

When qubits of the target register are measured in the X basis, this results in some determined-by-the-measurement-results subset of the possible address states having their amplitudes negated. Every address K has some associated data, specified as bits. During the lookup process, if the address is K then each bit determines whether or not a target qubit is flipped. When the X basis measurement is performed, some of the target qubits have TRUE measurement results. If an address K would have resulted in an odd number of the target qubits whose X basis measurement result was TRUE getting flipped, then the phase associated with K is negated. Otherwise it is not negated. The table F is created by checking, for each possible value of K, whether it has this “odd flips of trues” property or not. The target register is effectively destroyed by measuring it in the X basis. After the measurement all of its qubits are in a known state, and so they can individually be transformed or re-initialized into a zero state.

FIG. 4 is a circuit diagram 400 of two example quantum circuits for un-computing a table lookup. Quantum circuit 402 represents an uncomputation of a table lookup before the optimization process described in FIGS. 2 and 3 is applied. Quantum circuit 404 shows a specific sequence of operations for performing an uncomputation of a table lookup after the optimization process described in FIGS. 2 and 3 is applied. In other words, operations 418-436 can replace operations 414 and 416 as part of step 204 of FIG. 2.

The quantum circuit 402 operates on a control register 406, an address register 408, and a target register 412 of size M. In this example, the control register 406 includes one qubit. The address register 408 includes log d qubits, where d represents the total number of address register states. Qubit 410 represents the qubit in the address register that represents the least significant bit. The target register 412 includes M qubits.

Operation 414 represents a lookup operation D_(a) that determines a set of address register states that need to have their amplitudes negated in order to uncompute the target register. Operation 416 represents a negation of the address register states that need to have their amplitudes negated in order to uncompute the target register, as determined by operation 414.

The quantum circuit 404 also operates on a control register 406, address register 408, and target register 412, as well as a clean ancilla qubit prepared in a 1 state. The quantum circuit 404 includes a CNOT gate 418 that targets the ancilla qubit prepared in the 1 state and uses the qubit 410 as a control. Application of the CNOT gate 418 corresponds to step 304 described above with reference to FIG. 3.

The quantum circuit 404 includes two Hadamard gates 420 a, 420 b that operate on qubit 410 and the clean ancilla qubit, respectively. Application of the Hadamard gates 420 a, 420 b corresponds to step 306 described above with reference to FIG. 3.

The quantum circuit 404 includes multiple Hadamard gates 422 that are applied to each qubit in the target register 412. The quantum circuit 404 further includes multiple measurement operations 424, e.g., X basis measurements, that are applied to each qubit in the target register 412 after application of the multiple Hadamard gates 422. Application of the Hadamard gates 422 and the measurement operations 424 corresponds to step 302 described above with reference to FIG. 3.

The quantum circuit 404 further includes an operation 426 representing the computation of the fixup table F described above with reference to FIG. 3. Operation 426 refers to the classical control system processing the measurement results in order to determine which address register values had their phase negated. The result of this process is a table F. This table is an input into the lookup that will be performed to fix the phase negations. Values of the computed fixup table F are provided as input 432 to the lookup operation 430 that is applied to qubit 410 and the clean ancilla qubit. The lookup operation 430 determines a necessary negation of amplitudes of the address register states (without the qubit representing the least significant bit). Operation 430 represents how the quantum address a′ is being used to look up a value from the classically computed table F (subject to the control qubit seen in the same column being satisfied). This value is being xored into the indicated qubits. Operation 428 represents a negation of the address register states that need to have their amplitudes negated in order to uncompute the target register, as determined by operation 430. Application of operations 426-432 corresponds to step 308 described above with reference to FIG. 3.

The quantum circuit 404 includes two Hadamard gates 434 a, 434 b that operate on the qubit 410 and the clean ancilla qubit, respectively. The quantum circuit 404 further includes a CNOT operation 436 that targets the clean ancilla qubit and uses the qubit 410 as a control. Application of the Hadamard gates 434 a, 434 b and the CNOT gate 436 uncompute the qubit 410 and the clean ancilla qubit, corresponding to step 310 of FIG. 3.

In some implementations, if k additional clean ancilla qubits (qubits that are initialized to |0

) are available, the circuit optimization technique described above with reference to FIGS. 3 and 4 can be applied to achieve further reductions in the Toffoli cost of uncomputing a table lookup with address size d and output size M. In particular, the Toffoli cost can be reduced to ┌d/k┐+k.

In these implementations, to compute a table lookup a system allocates qubit registers r₀, . . . r_(k−1), where each qubit register r_(i) includes M clean qubits initialized to a first state, e.g., a 0 state. This register will store the output of the computation of the table lookup. The system then computes the table lookup with address h targeting the registers r₀, . . . , r_(k−1), where h represents the superposed integer value of the top ┌log(d/k)┐ qubits of the address register. The data for register r_(l) at address h is equal to the data from the original table at address h·k+l. In effect, this is reading many possible outputs at once. The application of this table lookup is referred to in this context as a T operation.

The system uses a series of Mk controlled swaps to permute the registers r₀, . . . , r_(k−1), such that register r_(l) takes the place of register r₀ where l represents a superposed integer value of the bottom logk qubits in the address register. The other registers can be permuted in any order. This application of Mk controlled swaps is referred to in this context as an S operation.

The register r₀ then stores the output. Every computational basis value of the address register results in a specific computational basis value for registers r₀, . . . , r_(k−1) at this point. The equivalent of a table lookup targeting r₀, . . . , r_(k−1) has been computed.

The swapping subroutine S has a Toffoli count of M(k−1). The table lookup subroutine T has a Toffoli count of ┌d/k┐. Both are performed once. Therefore, the total Toffoli count is ┌d/k┐+M(k−1). The space cost of the procedure is (k−1)M clean ancillae for workspace and ┌log(d/k)┐ clean ancillae in the implementation of T. The transformation also uses M qubits to store the output. The value of k that minimizes the Toffoli count is approximately √{square root over (d/M)}. In practice the number of available clean qubits can bound k to be a much smaller value.

FIG. 5 is a circuit diagram of an example quantum circuit 500 for applying the phase correction operation 430 described above with reference to FIG. 4 with clean ancilla qubits. The example quantum circuit 500 includes a control register 502, address register 504, and ancilla registers r₀, . . . , r_(k−1) 506.

A first X gate 508 is applied to register r₀. The X gate 508 flips the state of the r₀ from |0

to |1

.

A controlled S operation (as defined above) 510 is applied to the ancilla register 506, where the address register acts as a control. The controlled S operation 510 shifts the |1

state of r₀ to position 1, producing a one-hot unary encoding of the value in the bottom log k qubits in the address register 504.

Hadamard gates 512 are applied to each register r₀, . . . , r_(k−1). A controlled T gate (as defined above) 514 is applied to the ancilla register 506, where the address register acts as a control. Application of the Hadamard gates 512 and controlled T operation 514 yields the correct phase factor.

The operations 508, 510, and 512 combined perform a controlled swap operation. This operation is reversed to erase the unary encoding. That is, Hadamard gates 516 are applied to each qubit in the clean ancilla qubit register, a Hermitian conjugate of a controlled S operation 518 is applied to the ancilla register 506, where the address register acts as a control, and a second X gate 520 is applied to the register r₀.

The first controlled swap (operations 508, 510, and 512) has cost k−1, with the cost reduced as compared to the table lookup process/circuit described above with reference to FIGS. 3 and 4 because the outputs are single qubits instead of M-qubit registers. The T has cost ┌d/k┐, and the final controlled swap (operations 516, 518 and 520) may be performed with Clifford gates because unary encodings can be erased using measurements and Clifford gates. There are k ancillae used for the unary encoding, and as before there are ┌log(d/k)┐ ancillae needed for the implementation of T.

In some implementations, if k additional dirty ancilla qubits (qubits that are not necessarily initialized to |0

) are available, the circuit optimization technique described above with reference to FIGS. 3 and 4 can be applied to achieve further reductions in the Toffoli cost of uncomputing a table lookup with address size d and output size M. In particular, the Toffoli cost can be reduced to 2┌d/k┐+4k.

In these implementations, to compute a table lookup a system allocates a register r₀ with M clean qubits in a plus state. This register will store the output. The system obtains registers r₀, . . . , r_(k−1) each of size M containing dirty ancilla qubits. The system then uses a series of M(k−1) controlled swaps to permite the registers r₀, . . . , r_(k−1) such that register r₀ takes the place of register r_(l) where l represents a superposed integer value of the bottom logk qubits in the address register. The other registers can be permuted in any order. This application of M(k−1) controlled swaps is referred to in this context as an S operation.

The system performs a table lookup with address h targeting the registers r₀, . . . , r_(k−1), where h represents the superposed integer value of the top ┌log(d/k)┐ qubits of the address register. The data for register r_(l) at address h is equal to the data from the original table at address h·k+l. In effect, this is reading many possible outputs at once. The application of this table lookup is referred to in this context as a T operation.

The system performs the inverse of the S operation. The system applies Hadamard gates to r₀. Because the qubits in r₀ were in the plus state, they are not affected by the T operation (which only targeted them with controlled bit flips). Therefore, the system applies Hadamard gates to r₀ so that r₀ will be affected by the next T operation, which will uncompute the dirt XOR-ed into the other registers r₁, . . . , r_(k−1).

The system performs S, T, then the inverse of S. The register r₀ then stores the output, and the other registers r₁, . . . , r_(k−1) are restored. These restored registers can be “returned,” that is used for another purpose.

The swapping subroutine S has a Toffoli count of M(k−1). The table lookup subroutine T has a Toffoli count of ┌d/k┐. The S operation is computed/un-computed four times and T is performed twice. Therefore, the total Toffoli count is 2┌d/k┐+4M(k−1). The space cost of the procedure is (k−1)M dirty ancillae for workspace and ┌log(d/k)┐ clean ancillae in the implementation of T.

The transformation also uses M qubits to store the output. The value of k that minimizes the Toffoli count is approximately √{square root over (2d/M)}. In practice the number of available dirty qubits can bound k to be a much smaller value. The value of k must be greater than 2 in order to have a Toffoli count lower than a standard lookup.

FIG. 6 is a circuit diagram of an example quantum circuit 600 for applying the phase correction operation 430 described above with reference to FIG. 4 with dirty ancilla qubits. The example quantum circuit 600 includes a control register 602, address register 604, and ancilla register 606. The first qubit r₀ in the ancilla register 606 is a clean qubit and is initially set to |0

The qubits r₁, . . . , r_(k−1) in the ancilla register 606 are dirty qubits and not necessarily initially set to |0

.

A first Hadamard gate 608 is applied to the first qubit r₀ in the ancilla register 606. The Hadamard gate 608 creates a superposition state.

A controlled S operation 610 is applied to the ancilla register 606, where the address register acts as a control. A controlled T operation 612 is applied to the ancilla register 606, where the control register acts as a control. A Hermitian conjugate of a controlled S operation 614 is applied to the ancilla register 606, where the address register acts as a control. The gates 610, 612 and 614 have no effect on the first qubit r₀.

A Z gate 616 is applied to the qubit r₀. Application of the Z gate 616 changes the state of the qubit to (|0

−|1

)√2.

The operations 610, 612 and 614 are reversed through implementations of controlled S operation 618, controlled T operation 620 and Hermitian conjugate of a controlled S operation 622. The controlled T gate 620 yields the correct phase factor. A Z gate 624 and a Hadamard gate 626 are applied to the first qubit r₀ to return the state of r₀ to |0

.

There are k−1 dirty ancilla qubits used, one clean ancilla, and ┌log(d/k)┐ clean ancilla qubits needed for the implementation of T. In the case of clean ancilla qubits, the Toffoli cost is minimized for k≈√{square root over (d)}, where the Toffoli count is 2√{square root over (d)}. For dirty ancillae, the cost is minimized at k≈√{square root over (d/2)}, where the Toffoli count is √{square root over (32d)}.

Implementations of the digital and/or quantum subject matter and the digital functional operations and quantum operations described in this specification and appendix can be implemented in digital electronic circuitry, suitable quantum circuitry or, more generally, quantum computational systems, in tangibly-embodied digital and/or quantum computer software or firmware, in digital and/or quantum computer hardware, including the structures disclosed in this specification and their structural equivalents, or in combinations of one or more of them. The term “quantum computational systems” may include, but is not limited to, quantum computers, quantum information processing systems, quantum cryptography systems, or quantum simulators. Quantum computation systems in general and quantum computers specifically may be realized or based on different quantum computational models and architectures. For example, the quantum computation system may be based on or described by models such as the quantum circuit model, one-way quantum computation, adiabatic quantum computation, holonomic quantum computation, analog quantum computation, digital quantum computation, or topological quantum computation.

Implementations of the digital and/or quantum subject matter described in this specification can be implemented as one or more digital and/or quantum computer programs, i.e., one or more modules of digital and/or quantum computer program instructions encoded on a tangible non-transitory storage medium for execution by, or to control the operation of, data processing apparatus. The digital and/or quantum computer storage medium can be a machine-readable storage device, a machine-readable storage substrate, a random or serial access memory device, one or more qubits, or a combination of one or more of them. Alternatively or in addition, the program instructions can be encoded on an artificially-generated propagated signal that is capable of encoding digital and/or quantum information, e.g., a machine-generated electrical, optical, or electromagnetic signal, that is generated to encode digital and/or quantum information for transmission to suitable receiver apparatus for execution by a data processing apparatus.

The terms quantum information and quantum data refer to information or data that is carried by, held or stored in quantum systems, where the smallest non-trivial system is a qubit, i.e., a system that defines the unit of quantum information. It is understood that the term “qubit” encompasses all quantum systems that may be suitably approximated as a two-level system in the corresponding context. Such quantum systems may include multi-level systems, e.g., with two or more levels. By way of example, such systems can include atoms, electrons, photons, ions or superconducting qubits. In many implementations the computational basis states are identified with the ground and first excited states, however it is understood that other setups where the computational states are identified with higher level excited states are possible.

The term “data processing apparatus” refers to digital and/or quantum data processing hardware and encompasses all kinds of apparatus, devices, and machines for processing digital and/or quantum data, including by way of example a programmable digital processor, a programmable quantum processor, a digital computer, a quantum computer, multiple digital and quantum processors or computers, and combinations thereof. The apparatus can also be, or further include, special purpose logic circuitry, e.g., an FPGA (field programmable gate array), an ASIC (application-specific integrated circuit), or a quantum simulator, i.e., a quantum data processing apparatus that is designed to simulate or produce information about a specific quantum system. In particular, a quantum simulator is a special purpose quantum computer that does not have the capability to perform universal quantum computation. The apparatus can optionally include, in addition to hardware, code that creates an execution environment for digital and/or quantum computer programs, e.g., code that constitutes processor firmware, a protocol stack, a database management system, an operating system, or a combination of one or more of them.

A digital computer program, which may also be referred to or described as a program, software, a software application, a module, a software module, a script, or code, can be written in any form of programming language, including compiled or interpreted languages, or declarative or procedural languages, and it can be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a digital computing environment. A quantum computer program, which may also be referred to or described as a program, software, a software application, a module, a software module, a script, or code, can be written in any form of programming language, including compiled or interpreted languages, or declarative or procedural languages, and translated into a suitable quantum programming language, or can be written in a quantum programming language, e.g., QCL or Quipper.

A digital and/or quantum computer program may, but need not, correspond to a file in a file system. A program can be stored in a portion of a file that holds other programs or data, e.g., one or more scripts stored in a markup language document, in a single file dedicated to the program in question, or in multiple coordinated files, e.g., files that store one or more modules, sub-programs, or portions of code. A digital and/or quantum computer program can be deployed to be executed on one digital or one quantum computer or on multiple digital and/or quantum computers that are located at one site or distributed across multiple sites and interconnected by a digital and/or quantum data communication network. A quantum data communication network is understood to be a network that may transmit quantum data using quantum systems, e.g. qubits. Generally, a digital data communication network cannot transmit quantum data, however a quantum data communication network may transmit both quantum data and digital data.

The processes and logic flows described in this specification can be performed by one or more programmable digital and/or quantum computers, operating with one or more digital and/or quantum processors, as appropriate, executing one or more digital and/or quantum computer programs to perform functions by operating on input digital and quantum data and generating output. The processes and logic flows can also be performed by, and apparatus can also be implemented as, special purpose logic circuitry, e.g., an FPGA or an ASIC, or a quantum simulator, or by a combination of special purpose logic circuitry or quantum simulators and one or more programmed digital and/or quantum computers.

For a system of one or more digital and/or quantum computers to be “configured to” perform particular operations or actions means that the system has installed on it software, firmware, hardware, or a combination of them that in operation cause the system to perform the operations or actions. For one or more digital and/or quantum computer programs to be configured to perform particular operations or actions means that the one or more programs include instructions that, when executed by digital and/or quantum data processing apparatus, cause the apparatus to perform the operations or actions. A quantum computer may receive instructions from a digital computer that, when executed by the quantum computing apparatus, cause the apparatus to perform the operations or actions.

Digital and/or quantum computers suitable for the execution of a digital and/or quantum computer program can be based on general or special purpose digital and/or quantum processors or both, or any other kind of central digital and/or quantum processing unit. Generally, a central digital and/or quantum processing unit will receive instructions and digital and/or quantum data from a read-only memory, a random access memory, or quantum systems suitable for transmitting quantum data, e.g. photons, or combinations thereof.

Elements of a digital and/or quantum computer are a central processing unit for performing or executing instructions and one or more memory devices for storing instructions and digital and/or quantum data. The central processing unit and the memory can be supplemented by, or incorporated in, special purpose logic circuitry or quantum simulators. Generally, a digital and/or quantum computer will also include, or be operatively coupled to receive digital and/or quantum data from or transfer digital and/or quantum data to, or both, one or more mass storage devices for storing digital and/or quantum data, e.g., magnetic, magneto-optical disks, optical disks, or quantum systems suitable for storing quantum information. However, a digital and/or quantum computer need not have such devices.

Digital and/or quantum computer-readable media suitable for storing digital and/or quantum computer program instructions and digital and/or quantum data include all forms of non-volatile digital and/or quantum memory, media and memory devices, including by way of example semiconductor memory devices, e.g., EPROM, EEPROM, and flash memory devices; magnetic disks, e.g., internal hard disks or removable disks; magneto-optical disks; CD-ROM and DVD-ROM disks; and quantum systems, e.g., trapped atoms or electrons. It is understood that quantum memories are devices that can store quantum data for a long time with high fidelity and efficiency, e.g., light-matter interfaces where light is used for transmission and matter for storing and preserving the quantum features of quantum data such as superposition or quantum coherence.

Control of the various systems described in this specification, or portions of them, can be implemented in a digital and/or quantum computer program product that includes instructions that are stored on one or more non-transitory machine-readable storage media, and that are executable on one or more digital and/or quantum processing devices. The systems described in this specification, or portions of them, can each be implemented as an apparatus, method, or system that may include one or more digital and/or quantum processing devices and memory to store executable instructions to perform the operations described in this specification.

While this specification contains many specific implementation details, these should not be construed as limitations on the scope of what may be claimed, but rather as descriptions of features that may be specific to particular implementations. Certain features that are described in this specification in the context of separate implementations can also be implemented in combination in a single implementation. Conversely, various features that are described in the context of a single implementation can also be implemented in multiple implementations separately or in any suitable sub-combination. Moreover, although features may be described above as acting in certain combinations and even initially claimed as such, one or more features from a claimed combination can in some cases be excised from the combination, and the claimed combination may be directed to a sub-combination or variation of a sub-combination.

Similarly, while operations are depicted in the drawings in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order, or that all illustrated operations be performed, to achieve desirable results. In certain circumstances, multitasking and parallel processing may be advantageous. Moreover, the separation of various system modules and components in the implementations described above should not be understood as requiring such separation in all implementations, and it should be understood that the described program components and systems can generally be integrated together in a single software product or packaged into multiple software products.

Particular implementations of the subject matter have been described. Other implementations are within the scope of the following claims. For example, the actions recited in the claims can be performed in a different order and still achieve desirable results. As one example, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some cases, multitasking and parallel processing may be advantageous. 

What is claimed is:
 1. A method for uncomputing a first table lookup operation, the method comprising: identifying, from an address register of qubits, a set of qubit states that require an amplitude negation to complete an uncomputation of the first table lookup operation, wherein qubits in the address register represent respective bit values; computing i) a first qubit in the address register and ii) a second qubit, wherein the first qubit represents a least significant bit of the respective bit values and the second qubit comprises an ancilla qubit prepared in a 1 state, the computing comprising applying a first CNOT operation to the first qubit and the second qubit, wherein the first qubit acts as a control for the first CNOT operation, and applying a first Hadamard gate to the first qubit and a second Hadamard gate to the second qubit; performing a classically controlled phase correction operation based on the identified set of qubit states, comprising applying a second table lookup operation from a fixup table onto the first qubit and second qubit to negate amplitudes of the states in the identified set of qubit states; and uncomputing the first qubit and the second qubit.
 2. The method of claim, 1, wherein uncomputing the first qubit and the second qubit comprises: applying a third Hadamard gate to the first qubit and a fourth Hadamard gate to the second qubit; and applying a second CNOT operation to the first qubit and the second qubit, wherein the first qubit acts as a control for the second CNOT operation
 3. The method of claim 1, wherein entries of the fixup table specify respective two output bits defined by the identified set of states.
 4. The method of claim 1, wherein entries F_(j) of the fixup table F are expressed as $F_{j} = \left\{ \begin{matrix} {{00\ \left( {{2j} \notin S} \right)} \land \left( {{{2j} + 1} \notin S} \right)} \\ {{01\ \left( {{2j} \in S} \right)} \land \left( {{{2j} + 1} \notin S} \right)} \\ {{10\ \left( {{2j} \notin S} \right)} \land \left( {{{2j} + 1} \in S} \right)} \\ {{11\ \left( {{2j} \in S} \right)} \land \left( {{{2j} + 1} \in S} \right)} \end{matrix} \right.$ where S represents the determined set of states.
 5. The method of claim 1, wherein identifying, from the address register of qubits, the set of qubit states that require an amplitude negation to complete an uncomputation of the first table lookup operation comprises using X basis measurements of qubits in a corresponding target register.
 6. The method of claim 1, wherein the set of qubit states that require an amplitude negation to complete an uncomputation of the first table lookup operation comprise a subset of address register states.
 7. The method of claim 1, wherein a state of the address register encodes address information that determines a respective state of the target register, a state of the target register encodes a target output, and a relationship between each state of the address register and each state of the target register is represented as a table.
 8. The method of claim 7, wherein each entry in the table is represented by a respective multi-control multi-target CNOT operation, wherein qubits in the address register act as controls and qubits in the target register are targets for the CNOT operation.
 9. The method of claim 8, wherein each qubit in the address register uses one control and each qubit in the target register uses one target for the CNOT operation.
 10. The method of claim 1, wherein identifying, from the address register of qubits, the set of qubit states that require an amplitude negation to complete an uncomputation of the first table lookup operation comprises measuring qubits in the target register in the X basis to determine a value of an observable, the observable comprising Pauli-X operators on qubits toggled by a corresponding compute table lookup operation.
 11. An apparatus comprising: one or more classical processors; and quantum computing hardware in data communication with the one or more classical processors, wherein the one or more classical processors comprise one or more storage devices storing instructions that are operable, when executed by the one or more classical processors, to cause the one or more classical processors to perform operations comprising: identifying, from an address register of qubits, a set of qubit states that require an amplitude negation to complete an uncomputation of the first table lookup operation, wherein qubits in the address register represent respective bit values; computing i) a first qubit in the address register and ii) a second qubit, wherein the first qubit represents a least significant bit of the respective bit values and the second qubit comprises an ancilla qubit prepared in a 1 state, the computing comprising applying a first CNOT operation to the first qubit and the second qubit, wherein the first qubit acts as a control for the first CNOT operation, and applying a first Hadamard gate to the first qubit and a second Hadamard gate to the second qubit; performing a classically controlled phase correction operation based on the identified set of qubit states, comprising applying a second table lookup operation from a fixup table onto the first qubit and second qubit to negate amplitudes of the states in the identified set of qubit states; and uncomputing the first qubit and the second qubit.
 12. The apparatus of claim 11, wherein the quantum computing hardware comprises: one or more registers of qubits; a plurality of control lines coupled to the one or more registers of qubits; and a plurality of control circuits coupled to the plurality of control lines.
 13. The apparatus of claim, 11, wherein uncomputing the first qubit and the second qubit comprises: applying a third Hadamard gate to the first qubit and a fourth Hadamard gate to the second qubit; and applying a second CNOT operation to the first qubit and the second qubit, wherein the first qubit acts as a control for the second CNOT operation
 14. The apparatus of claim 11, wherein entries of the fixup table specify respective two output bits defined by the identified set of states.
 15. The apparatus of claim 11, wherein entries F_(j) of the fixup table F are expressed as $F_{j} = \left\{ \begin{matrix} {{00\ \left( {{2j} \notin S} \right)} \land \left( {{{2j} + 1} \notin S} \right)} \\ {{01\ \left( {{2j} \in S} \right)} \land \left( {{{2j} + 1} \notin S} \right)} \\ {{10\ \left( {{2j} \notin S} \right)} \land \left( {{{2j} + 1} \in S} \right)} \\ {{11\ \left( {{2j} \in S} \right)} \land \left( {{{2j} + 1} \in S} \right)} \end{matrix} \right.$ where S represents the determined set of states.
 16. The apparatus of claim 11, wherein identifying, from the address register of qubits, the set of qubit states that require an amplitude negation to complete an uncomputation of the first table lookup operation comprises using X basis measurements of qubits in a corresponding target register.
 17. The apparatus of claim 11, wherein the set of qubit states that require an amplitude negation to complete an uncomputation of the first table lookup operation comprise a subset of address register states.
 18. The apparatus of claim 1, wherein a state of the address register encodes address information that determines a respective state of the target register, a state of the target register encodes a target output, and a relationship between each state of the address register and each state of the target register is represented as a table.
 19. The apparatus of claim 18, wherein each entry in the table is represented by a respective multi-control multi-target CNOT operation, wherein qubits in the address register act as controls and qubits in the target register are targets for the CNOT operation.
 20. The apparatus of claim 11, wherein identifying, from the address register of qubits, the set of qubit states that require an amplitude negation to complete an uncomputation of the first table lookup operation comprises measuring qubits in the target register in the X basis to determine a value of an observable, the observable comprising Pauli-X operators on qubits toggled by a corresponding compute table lookup operation. 